package com.job.client.posts.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.job.client.common.result.ResponseResult;
import com.job.client.common.utils.ListToChildrenUtils;
import com.job.client.model.posts.pojo.Category;
import com.job.client.model.posts.vo.CategoryVo;
import com.job.client.posts.mapper.CategoryMapper;
import com.job.client.posts.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 职位分类表 服务实现类
 * </p>
 *
 * @author fkl
 * @since 2023-12-06
 */
@Service
public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> implements CategoryService {
    @Autowired
    private CategoryMapper categoryMapper;

    @Override
    public ResponseResult getCategoryList() {
        List<Category> categoryList = categoryMapper.selectList(null);
        List<CategoryVo> categoryVoList = ListToChildrenUtils.convertCategoriesToVo(categoryList);
        return ResponseResult.OkResult(categoryVoList);
    }
}
